#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 10001
#define inf 0x7f7f7f7f
#define Rep(i,a,b) for(int i=(a);i<=(b);++i)
#define Per(i,a,b) for(int i=(a);i>=(b);--i)
int n,q,opt,x,y;
int a[maxn],b[maxn];
inline void Read(int &x) {
	int s=0;
	bool w=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')w=ch=='-'?1:w,ch=getchar();
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	x=w?-s:s;
}
inline int Sort(int x) {
	Rep(i,1,n)b[i]=a[i];
	Rep(i,1,n) {
		Per(j,i,2) {
			if(b[j]<b[j-1]) {
				swap(b[j],b[j-1]);
				if(j==x)x--;
			}
		}
	}
	return x;
}
int main() {
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	Read(n),Read(q);
	Rep(i,1,n)Read(a[i]);
	Rep(i,1,q) {
		Read(opt);
		if(opt==1) {
			Read(x),Read(y);
			a[x]=y;
		} else {
			Read(x);
			printf("%d\n",Sort(x));
		}
	}
	return 0;
}

